package com.cos.students.util;

import lombok.extern.slf4j.Slf4j;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author: COS
 * @time: 2022/10/28 10:20
 * @description:
 */
@Slf4j
public class DateUtil {
    private static final SimpleDateFormat sdf  = new SimpleDateFormat("yyyy-MM-dd");
    public static Date stringToDate(String date){
        try {
            return sdf.parse(date);
        } catch (ParseException e) {
//            e.printStackTrace();
            log.info("日期格式化失败,返回固定值null");
            return null;
        }
    }

}
